package com.xxgc.eow.service.impl;

import com.github.pagehelper.PageHelper;
import com.xxgc.eow.entity.Treatmenttype;
import com.xxgc.eow.mapper.TreatmenttypeMapper;
import com.xxgc.eow.service.ITreatmenttypeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 待遇类型表 服务实现类
 * </p>
 *
 * @author Mr.Abel
 * @since 2023-05-22
 */
@Service
public class TreatmenttypeServiceImpl extends ServiceImpl<TreatmenttypeMapper, Treatmenttype> implements ITreatmenttypeService {

    @Resource
    private TreatmenttypeMapper treatmenttypeMapper;

    @Override
    public int delTreatmentType(Treatmenttype treatmenttype) {
        return treatmenttypeMapper.deleteByPrimaryKey(treatmenttype);
    }

    @Override
    public List<Treatmenttype> getByKeyWord(int pageNum, int pageSize, String keyWord) {
        PageHelper.startPage(pageNum,pageSize);
        return treatmenttypeMapper.selectBykeyWord(keyWord);
    }

    @Override
    public List<Treatmenttype> getAllPage(String keyWord) {
        return treatmenttypeMapper.selectBykeyWord(keyWord);
    }

    @Override
    public int addTreatmentType(Treatmenttype treatmenttype) {
        return treatmenttypeMapper.insert(treatmenttype);
    }

    @Override
    public int updatTreatmentType(Treatmenttype treatmenttype) {
        return treatmenttypeMapper.updateByPrimaryKey(treatmenttype);
    }
}
